import 'package:car_map/mode/time_scale.dart';
import 'package:car_map/page/res/gaps.dart';
import 'package:car_map/widget/item_device_details.dart';
import 'package:car_map/widget/widget_grouping_title.dart';
import 'package:car_map/widget/widget_search_textfield.dart';
import 'package:flutter/material.dart';

///设备详情
class DeviceDetailsPage extends StatefulWidget{
  @override
  _deviceDetailsState createState() =>_deviceDetailsState();

}

class _deviceDetailsState extends State<DeviceDetailsPage>{

  List<TimeScale> scaleList;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    getTimeScaleList();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('设备详情'),
      ),
      body: Container(
        padding: EdgeInsets.only(left: 10.0,right: 10.0),
        child: ListView(
          children: <Widget>[
            WidgetGroupingTitle(
              timeScale: scaleList,
            ),
            Gaps.vGap10,
            WidgetSearchTextField(),

            ListView.builder(itemBuilder: (context,index){
              return ItemDeviceDetails();
            },itemCount: 5,shrinkWrap: true,physics: new NeverScrollableScrollPhysics(),)
          ],
        ),
      ),
    );
  }


  List<TimeScale> getTimeScaleList() {
    scaleList = new List();
    scaleList.add(new TimeScale(title: '全部(9)'));
    scaleList.add(new TimeScale(title: '在线(6)'));
    scaleList.add(new TimeScale(title: '离线(3)'));
    scaleList.add(new TimeScale(title: '过期(0)'));
  }
}